package com.yanqu.road.server.cmd.beautyescort;

import com.yanqu.road.pb.beautyescort.BeautyEscortProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.logic.MessageHelper;
import com.yanqu.road.server.manager.beautyescort.CrossBeautyEscortMgr;
import com.yanqu.road.server.manager.beautyescort.CrossEscortPlayerWrap;
import com.yanqu.road.utils.YanQuMessageUtils;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.C_BEAUTY_ESCORT_CARTS_DETAIL, desc = "镖详情--官道")
public class CrossBeautyEscortCartDetailReqMsg extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        CrossEscortPlayerWrap escortPlayer = CrossBeautyEscortMgr.getEscortPlayer(serverId, packet.getPlayerId());
        if(escortPlayer != null){
            escortPlayer.calAllCartState();
            BeautyEscortProto.BeautyEscortRoadDetailRespMsg.Builder respMsg = BeautyEscortProto.BeautyEscortRoadDetailRespMsg.newBuilder();
            respMsg.setRet(ret);
            respMsg.addAllCart(escortPlayer.getCartDetailTemp());
            MessageHelper.sendPacket(serverId, packet.getPlayerId(), YanQuMessageUtils.buildMessage(Protocol.U_BEAUTY_ESCORT_CARTS_DETAIL, respMsg));
        }
    }

    @Override
    public void sendData() {

    }
}
